package com.jiangruan.javaproject.service;

import com.Constants;
import com.alibaba.fastjson.JSONObject;
import com.jiangruan.javaproject.bean.HotVideo;
import com.jiangruan.javaproject.bean.HotVideoCommon;
import com.jiangruan.javaproject.request.HttpUtils;

import java.util.List;
/*
该方法用于获取热门数据，并将热门数据返回


*/

public class HotVideoService {
    public List<HotVideo> gitHotVideo(){
        String url = Constants.TEIP_URL
                + "?key=" + Constants.TEIP_KEY
                + "&type=hot_video"
                + "&size=20";
        String result = HttpUtils.get(url);
        System.out.println(result);
        //jion解析
        HotVideoCommon VideoCommon = JSONObject.parseObject(result, HotVideoCommon.class);

        return VideoCommon.result;
    }
}
